package cn.edu.wynu.api.stringapi;

public class StringContainsLearn {
    public static void main(String[] args) {
        String s = "The Java language provides special support for the string concatenation operator ";
        // 判断一个字符串中是否存在一个子串
        boolean bContains = s.contains("concatenation");

        if (bContains) {
            System.out.println("s里面存在子串concatenation");
        } else {
            System.out.println("s里面不存在子串concatenation");
        }

        // 获取串中第一次出现指定字符的索引，如果找不到则返回-1
        int c = s.lastIndexOf('c');
        System.out.println(c);
    }
}
